<template>
  <div class="main">
    <div class="body">
      <audio
        src="../../video/xinyang.mp3"
        id="music"
        autoplay
        loop
        preload
      ></audio>
      <div class="present">
        <div class="teddy-hat">
          <div class="dot"></div>
        </div>
        <div class="teddy-head">
          <div class="bear_eyes"></div>
          <div class="bear_nose"></div>
          <div class="bear_mouth"></div>
        </div>
        <div class="teddy-ear"></div>
        <div class="teddy-body"></div>
      </div>
      <div class="content">
        <span>圣</span><span>诞</span><span>快</span><span>乐</span>
      </div>
    </div>
  </div>
</template>
<script>
export default {
  data() {
    return {};
  },
  methods: {},
  mounted() {},
};
</script>
<style lang='scss' scoped>
.main {
  position: relative;
}
.present {
  width: 500px;
  height: 500px;
  // background: blue;
  position: relative;
  animation: teddy_change 3s linear infinite;
  .teddy-hat {
    z-index: 4;
    background: #eee;
    width: 150px;
    height: 60px;
    position: absolute;
    left: 130px;
    top: 140px;
    border-radius: 120px 80px 120px 80px;
    transform: rotate(-21deg);
    &::before {
      content: "";
      background: red;
      width: 125px;
      height: 67px;
      position: absolute;
      left: 10px;
      top: -35px;
      border-radius: 100px 200px 0px 0px;
    }
    &::after {
      content: "";
      width: 0px;
      height: 0px;
      position: absolute;
      left: -65px;
      top: 20px;
      border-right: 30px solid transparent;
      border-top: 57px solid red;
      border-left: 135px solid transparent;
      transform: rotate(-56deg);
      border-radius: 70px;
    }
    .dot {
      z-index: 4;
      background: #eee;
      width: 40px;
      height: 40px;
      position: absolute;
      left: -53px;
      top: 65px;
      border-radius: 50%;
    }
  }
  .teddy-head {
    z-index: 3;
    background: #cc8b4e;
    width: 205px;
    height: 170px;
    position: absolute;
    left: 160px;
    top: 150px;
    border-radius: 60% 60% 58% 60%;
    //方式1:静态眼睛
    // .bear_eyes{
    //     width: 20px;
    //     height: 20px;
    //     // background: #000;
    //     position: absolute;
    //     left:20px;
    //     top: 54px;
    //     border-radius: 50%;
    //     // box-shadow: 30px 0 0px 0px #000
    //     // 第一个参数x轴移动 负值为向右移动，正直为向左移动
    //     //第二个参数为y轴移动 负值向下，正直向上
    //     //第三个参数模糊程度
    //     //第四个参数 扩大或者缩小，正直扩大，负值缩小
    //     //第五个参数 颜色
    //     box-shadow:30px  -3px 0px -7px #eee, 105px  -3px 0px -7px #eee,30px 0 0px 0px #000,105px 0 0px 0px #000,;
    // }
    // 方式2:伪元素 动态眼睛
    .bear_eyes {
      width: 20px;
      height: 20px;
      background: #000;
      position: absolute;
      left: 50px;
      top: 54px;
      border-radius: 50%;
      box-shadow: 76px 0px 0px 0px #000;
      &:after {
        content: "";
        position: absolute;
        right: 6px;
        top: 4px;
        width: 5px;
        height: 5px;
        border-radius: 50%;
        background: #eee;
        box-shadow: 76px 0 0 0 #eee;
        animation: eye_change 20s linear infinite;
      }
    }
    .bear_nose {
      position: absolute;
      left: 87px;
      top: 83px;
      width: 0px;
      height: 0px;
      border: 15px solid transparent;
      border-top: 16px solid #000;
      border-radius: 50%;
      &::before {
        content: "";
        position: absolute;
        width: 0px;
        height: 0px;
        border: 15px solid transparent;
        border-top: 16px solid #000;
        border-radius: 50%;
        transform: rotate(110deg) translate(-14px, 25px);
      }
      &::after {
        content: "";
        position: absolute;
        width: 0px;
        height: 0px;
        border: 15px solid transparent;
        border-top: 16px solid #000;
        border-radius: 50%;
        transform: rotate(-110deg) translate(24px, -3px);
      }
    }
    .bear_mouth {
      position: absolute;
      left: 88px;
      top: 80px;
      width: 20px;
      height: 20px;
      &::before {
        content: "";
        position: absolute;
        left: 3px;
        top: 5px;
        width: 25px;
        height: 25px;
        border-radius: 50%;
        border: 3px solid #000;
        border-bottom-color: transparent;
        border-left-color: transparent;
        transform: translateX(-17px) rotate(130deg);
      }
      &::after {
        content: "";
        position: absolute;
        left: 3px;
        top: 5px;
        width: 25px;
        height: 25px;
        border-radius: 50%;
        border: 3px solid #000;
        border-bottom-color: transparent;
        border-right: transparent;
        transform: translateX(10px) rotate(-130deg);
      }
    }
  }
  .teddy-ear {
    background: #cc8b4e;
    width: 65px;
    height: 60px;
    position: absolute;
    border-radius: 60% 60% 58% 60%;
    left: 310px;
    top: 150px;
    &::before {
      content: "";
      background: #ffc793;
      width: 45px;
      height: 40px;
      position: absolute;
      border-radius: 60% 60% 58% 60%;
      left: 11px;
      top: 11px;
    }
  }
  // .teddy-body {
  //   background: #cc8b4e;
  //   width: 175px;
  //   height: 200px;
  //   position: absolute;
  //   border-radius: 50%;
  //   left: 175px;
  //   top: 260px;
  // }
}
.body {
  padding: 0px;
  margin: 0px;
  display: flex;
  justify-content: center;
  text-align: center;
  height: 100vh;
  color: #fff;
  align-items: center;
  background: #000;
  animation: bg_change 10s ease-in-out infinite;
  &::before {
    content: ""; // 必须加content否则伪元素不会生效
    position: absolute;
    top: 0px;
    width: 100%;
    height: 35%;
    // background: #fff;
    background-image: radial-gradient(circle, #f17900 10%, transparent 10%),
      radial-gradient(circle, red 13%, transparent 10%); //画圆
    background-size: 100px 100px; //平铺区域
    background-repeat: repeat; //平铺
    background-position: 0 0, 50px 50px; //远点位置
    overflow: hidden; //隐藏滚动
    opacity: 0.7;
    animation: line_blink 3s linear infinite;
  }
  &::after {
    content: "";
    position: absolute;
    top: 0px;
    width: 100%;
    height: 35%;
    background-image: radial-gradient(circle, blue 9%, transparent 10%),
      radial-gradient(circle, #6c00c5 11%, transparent 10%);
    background-size: 100px 100px;
    background-repeat: repeat;
    background-position: 40px 20px, 60px 80px;
    overflow: hidden;
    opacity: 0.7;
  }
}
.content {
  position: absolute;
  bottom: 120px;
  text-align: center;
  animation: content_chengae 10s linear infinite;
}
//背景动画
@keyframes bg_change {
  0% {
    background: #2d2416;
  }
  50% {
    background: #192d16;
  }
  100% {
    background: #2d1629;
  }
}
//灯光动画
@keyframes line_blink {
  50% {
    opacity: 0.1;
    transform: translateX(2px) translateY(3px);
  }
}
//眼睛动画
@keyframes eye_change {
  50% {
    right: 9px;
    top: 7px;
  }
}
@keyframes teddy_change {
  10% {
    transform: rotate(3deg);
  }
  60% {
    transform: rotate(-3deg);
  }
}
@keyframes content_chengae {
  50% {
    position: absolute;
    bottom: 120px;
    font: 700 100px "Comic Sans MS";
    color: white;
    text-shadow: 0 0 20px #fdec84, 10px -10px 30px #ffae35,
      20px -20px 40px #ec760c, -20px -60px 50px #cd4607, 0px -80px 60px #973717,
      10px -40px 70px #451b0e;
  }
}
</style>